﻿using AMAP.Domain;
using AMAP.ServiceClasses.Common;
using AMAP.ServiceInterfaces;
using AMAP.ServiceInterfaces.Common;
using System.Collections.Generic;
using System.Linq;

namespace AMAP.ServiceClasses
{
    public class VolunteerService : BaseRepositoryService<Volunteer>, IVolunteerService
    {
        public VolunteerService(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {
        }

        public override Volunteer Create()
        {
            Volunteer v = new Volunteer();
            v.User = new User();

            return v;
        }

        public Volunteer GetByEmail(string Email)
        {
            return this.dataContext.VolunteerSet.FirstOrDefault(v => v.User.Email == Email);
        }

    }
}
